//
//  CustomCollectionViewCell.m
//  UI_19_Homework
//
//  Created by dllo on 16/1/29.
//  Copyright © 2016年 LZB. All rights reserved.
//

#import "CustomCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@implementation CustomCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.movieImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
//        self.movieImageView.backgroundColor = [UIColor blueColor];
        [self addSubview:self.movieImageView];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        self.titleLabel.textColor = [UIColor orangeColor];
        self.titleLabel.numberOfLines = 2;
//        self.titleLabel.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.titleLabel];
    }
    return self;
}

- (void)layoutSubviews {
    self.movieImageView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 55);
    self.titleLabel.frame = CGRectMake(0, self.movieImageView.frame.size.height + 5, self.frame.size.width, 50);
}

- (void)setMovieDetailModel:(MovieDetailModel *)movieDetailModel {
    _movieDetailModel = movieDetailModel;
    [self.movieImageView sd_setImageWithURL:[NSURL URLWithString:_movieDetailModel.imagesModel.large]];
    self.titleLabel.text = _movieDetailModel.title;
//    NSLog(@"%@", self.titleLabel.text);
}
@end
